check_ip() {
    ping -c 3 -W 3 "$1" &> /dev/null
    if [ $? -eq 0 ]; then
        echo "success"
    else
        echo "fail"
    fi
}

check_ip "$1"
